<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"  isELIgnored="false"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
    <title>增加商品资料</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="stylesheet" type="text/css" href="css/fabusp.css" />
    <script>
    function addt() {
    	var c_id = $("#c_id").val();
    	var c_name = $("#c_name").val();
    	var c_point = $("#c_point").val();
    	var c_time = $("#c_time").val();
    	var g_id = $("#g_id").val();
    	if("" == c_name)
    		{
    		alert("课程名称不能为空");
    		return false;
    		}
    	else if("" == c_id)
    		{
    		alert("课程编号不能为空");
    		return false;
    		}
    	else if("" == c_time)
    		{
    		alert("学时不能为空");
    		return false;
    		}
    	else if("" == c_point)
		{
		alert("学分不能为空");
		return false;
		}
    	$.ajax({
    		type :"POST",
    		   url : "AddCourse",
    		   dataType :"json",           
    		   async : false,
    		   data : {
    			   "c_id" : c_id,
    			   "c_name" : c_name,
    			   "c_point" : c_point,
    			   "c_time" : c_time,
    			   "g_id" : g_id,
    		   },
    		   success:function(data){
    			   $('#tea_name').val(""); 
    			   $('#tea_id').val(""); 
    			   alert(data[0].waring);
    		   },
    		   error:function(data){
    			   $('#tea_name').val(""); 
    			   $('#tea_id').val(""); 
    			   alert("返回数据失败");
    		   }
    	});
    }
    </script>
</head>
<body bgcolor="#fcfcfc" style='background-image:url(../../images/bg.jpg) ;background-repeat:no-repeat ;
background-size:100% 100%;
background-attachment: fixed;'>



    <div class="main">
            <table width="420" border="0" align="left" cellpadding="0" cellspacing="0" id="tabcss">
				<tr>
					<td><b>课程信息录入</b></td>
				</tr>
				<tr>
                    <td width="381">
                       课程编号
                        <input type="text" id="c_id" size="36" placeholder="请输入课程编号">
                    </td>
                </tr>
                <tr>
                    <td width="381">
                        课程名称
                        <input type="text" id="c_name"  size="36" placeholder="请输入课程名称">
                    </td>
                </tr>
                <tr>
                    <td width="381">
                        学&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;分
                        <input type="text" id="c_point" size="36" placeholder="精确到0.5">
                    </td>
                </tr>
                <tr>
                    <td width="381">
                        学&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;时
                        <input type="text" id="c_time" size="36" placeholder="/课时">
                    </td>
                </tr>
                <tr>
                    <td width="381">
                        年&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;级
                        <select id = "g_id"> 
<option  value="1">大一上学期</option>
<option  value="2">大一下学期</option>
<option  value="3">大二上学期</option>
<option  value="4">大二下学期</option>
<option  value="5">大三上学期</option>
<option  value="6">大三下学期</option>
<option  value="7">大四上学期</option>
<option  value="8">大四下学期</option>
</select>
                    </td>
                </tr>
                <tr>
                    <td height="40" colspan="2">
                    <input type="button" value = "提交" class = "button" onclick = "addt()"/></td>
                </tr>
            </table>
    </div>
</body>

</html>
<script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>


